package com.pphh.demo;

import java.util.UUID;

/**
 * Please add description here.
 *
 * @author huangyinhuang
 * @date 11/12/2018
 */
public class TraceId {

    private static final ThreadLocal<String> traceId = new ThreadLocal<String>();

    public static String get() {
        String id = traceId.get();
        if (id == null) {
            id = UUID.randomUUID().toString();
            traceId.set(id);
        }
        return id;
    }

}
